home *** CD-ROM | disk | FTP | other *** search
- /* Reaction Inter-Connection Notification Example
- Ported to D by DMX
- */
-
- MODULE 'exec/nodes','intuition','graphics','intuition/intuition','lib/amiga',
- 'intuition/gadgetclass','intuition/imageclass',
- 'intuition/intuitionbase','intuition/classusr',
- 'intuition/gadgetclass','intuition/cghooks','intuition/icclass',
- 'intuition/classes'
-
- MODULE 'libraries/gadtools','intuition/icclass','dos','dos/dos',
- 'graphics','intuition','intuition/intuition','utility/tagitem'
-
- MODULE 'window','classes/window','layout','gadgets/layout','gadgets/palette',
- 'gadgets/button','images/bevel','palette','images/label','label',
- 'classes/window','reaction/reaction_macros','button','reaction/reaction'
-
- DEF ButtonBase:PTR TO ClassLibrary,LabelBase:PTR TO ClassLibrary,PaletteBase:PTR TO ClassLibrary
- DEF LayoutBase:PTR TO ClassLibrary,WindowBase:PTR TO ClassLibrary
-
-
- CONST ID_BUTTON=1,ID_FOREGROUND=2,ID_BACKGROUND=3
-
- PROC main()
-
- DEF window:PTR TO Window,
- but_object:PTR TO Object,
- win_object:PTR TO Object,
- mapfg2button, mapbg2button,
- tmpres1,tmpres2
- DEF wait, signal, result, done=FALSE, code
-
- mapfg2button := [PALETTE_Color, BUTTON_TextPen, TAG_END]
- mapbg2button := [PALETTE_Color, BUTTON_BackgroundPen, TAG_END]
-
- WindowBase := OpenLibrary('window.class',0)
- LayoutBase := OpenLibrary('gadgets/layout.gadget',0)
- ButtonBase := OpenLibrary('gadgets/button.gadget',0)
- PaletteBase := OpenLibrary('gadgets/palette.gadget',0)
- LabelBase := OpenLibrary('images/label.image',0)
-
- IF (WindowBase AND LayoutBase AND ButtonBase AND PaletteBase AND LabelBase)
-
- -> Create the window object.
-
- win_object := WindowObject,
- WA_ScreenTitle, 'Interconnect',
- WA_Title, 'Reaction Example',
- WA_SizeGadget, TRUE,
- WA_Left, 40,
- WA_Top, 30,
- WA_DepthGadget, TRUE,
- WA_DragBar, TRUE,
- WA_CloseGadget, TRUE,
- WA_Activate, TRUE,
- WA_SmartRefresh, TRUE,
-
- WINDOW_ParentGroup, VLayoutObject,
- LAYOUT_SpaceOuter, TRUE,
- LAYOUT_DeferLayout, TRUE,
- LAYOUT_BevelStyle, GroupFrame,
- LAYOUT_Label, 'InterConnection',
-
- StartMember, but_object := ButtonObject,
- GA_Text, '_Inter-Connection Example',
- GA_ID, ID_BUTTON,
- EndMember,
- CHILD_WeightedHeight, 0,
-
- StartMember, HLayoutObject,
- LAYOUT_SpaceOuter, FALSE,
-
- StartMember, PaletteObject,
- GA_ID, ID_FOREGROUND,
- PALETTE_NumColors, 8,
- PALETTE_Color, 1,
- ICA_TARGET, but_object, /* object to connect to */
- ICA_MAP, mapfg2button, /* tag mapping array */
- EndMember,
- CHILD_Label, LabelObject, LABEL_Text, '_ForeGround', LabelEnd,
- CHILD_MinWidth, 90,
- CHILD_MinHeight, 20,
-
- StartMember, PaletteObject,
- GA_ID, ID_BACKGROUND,
- PALETTE_NumColors, 8,
- PALETTE_Color, 0,
- ICA_TARGET, but_object, /* object to connect to */
- ICA_MAP, mapbg2button, /* tag mapping array */
- EndMember,
- CHILD_Label, LabelObject, LABEL_Text, '_BackGround', LabelEnd,
- CHILD_MinWidth, 90,
- CHILD_MinHeight, 20,
- EndMember,
- EndMember,
- EndWindow
-
- -> Object creation sucessful?
-
- IF win_object
-
- -> Open the window.
-
- IF (window := RA_OpenWindow(win_object))
-
- -> Obtain the window wait signal mask.
-
- GetAttr(WINDOW_SigMask, win_object, &signal)
-
- -> Input Event Loop
-
- WHILE (done = FALSE)
- wait := Wait(signal OR SIGBREAKF_CTRL_C)
-
- IF (wait AND SIGBREAKF_CTRL_C)
- done := TRUE
-
- ELSE
-
- WHILE ((result := RA_HandleInput(win_object,&code)) <> WMHI_LASTMSG)
-
- tmpres1 := (result AND WMHI_CLASSMASK)
-
- SELECT tmpres1
-
- CASE WMHI_CLOSEWINDOW ; done := TRUE
-
- CASE WMHI_GADGETUP
- tmpres2 := (result AND WMHI_GADGETMASK)
-
- SELECT tmpres2
- CASE ID_BUTTON //; NOP
- ENDSELECT
-
- ENDSELECT
-
- ENDWHILE
- ENDIF
- ENDWHILE
- ENDIF
-
- /* Disposing of the window object will
- * also close the window if it is
- * already opened and it will dispose of
- * all objects attached to it.
- */
- DisposeObject(win_object )
- ENDIF
- ENDIF
-
- -> Close the classes.
-
- IF LabelBase THEN CloseLibrary(LabelBase)
- IF PaletteBase THEN CloseLibrary(PaletteBase)
- IF ButtonBase THEN CloseLibrary(ButtonBase)
- IF LayoutBase THEN CloseLibrary(LayoutBase)
- IF WindowBase THEN CloseLibrary(WindowBase)
-
- ENDPROC
-